<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>第二章 探花交友 - 环境搭建 | 谦谦君子</title>
  <meta name="keywords" content=" 探花交友 , 项目 ">
  <meta name="description" content="第二章 探花交友 - 环境搭建 | 谦谦君子">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="谦谦君子的个人博客,谦谦君子，湛礼桂">
<meta property="og:type" content="website">
<meta property="og:title" content="about">
<meta property="og:url" content="https://zhanligui.gitee.io/about/index.html">
<meta property="og:site_name" content="谦谦君子">
<meta property="og:description" content="谦谦君子的个人博客,谦谦君子，湛礼桂">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-10-21T09:27:05.000Z">
<meta property="article:modified_time" content="2021-12-06T06:50:36.883Z">
<meta property="article:author" content="谦谦君子">
<meta property="article:tag" content="谦谦君子的个人博客,谦谦君子，湛礼桂">
<meta name="twitter:card" content="summary">


<link rel="icon" href="/img/avatar.jpg">

<link href="/css/style.css?v=1.1.0" rel="stylesheet">

<link href="/css/hl_theme/atom-light.css?v=1.1.0" rel="stylesheet">

<link href="//cdn.jsdelivr.net/npm/animate.css@4.1.0/animate.min.css" rel="stylesheet">

<script src="//cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="/js/titleTip.js?v=1.1.0" ></script>

<script src="//cdn.jsdelivr.net/npm/highlightjs@9.16.2/highlight.pack.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

<script src="//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js"></script>



<script src="//cdn.jsdelivr.net/npm/jquery.cookie@1.4.1/jquery.cookie.min.js" ></script>

<script src="/js/iconfont.js?v=1.1.0" ></script>

<meta name="generator" content="Hexo 5.2.0"></head>
<div style="display: none">
  <input class="theme_disqus_on" value="false">
  <input class="theme_preload_comment" value="">
  <input class="theme_blog_path" value="">
  <input id="theme_shortcut" value="true" />
  <input id="theme_highlight_on" value="true" />
  <input id="theme_code_copy" value="true" />
</div>



<body>
<aside class="nav">
    <div class="nav-left">
        <a href="/"
   class="avatar_target">
    <img class="avatar"
         src="/img/avatar.jpg"/>
</a>
<div class="author">
    <span>谦谦君子</span>
</div>

<div class="icon">
    
        
            <a title="rss"
               href="/atom.xml"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-rss"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="github"
               href="https://github.com/yelog"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-github"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="facebook"
               href="https://www.facebook.com/faker.tops"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-facebook"></use>
                    </svg>
                
            </a>
        
    
        
    
        
    
        
            <a title="instagram"
               href="https://www.facebook.com/faker.tops"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-instagram"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="reddit"
               href="https://www.reddit.com/user/yelog/"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-reddit"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="weibo"
               href="http://weibo.com/u/2307534817"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-weibo"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="jianshu"
               href="https://www.jianshu.com/u/ff56736de7cf"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-jianshu"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="zhihu"
               href="https://www.zhihu.com/people/jaytp/activities"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-zhihu"></use>
                    </svg>
                
            </a>
        
    
        
    
        
            <a title="oschina"
               href="https://my.oschina.net/yelog"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-oschina"></use>
                    </svg>
                
            </a>
        
    
        
    
        
            <a title="email"
               href="mailto:jaytp@qq.com"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-email"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="qq"
               href="http://wpa.qq.com/msgrd?v=3&uin=872336115&site=qq&menu=yes"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-qq"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="kugou"
               href="https://www.kugou.com/"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-kugou"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="neteasemusic"
               href="https://music.163.com/#/user/home?id=88151013"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-neteasemusic"></use>
                    </svg>
                
            </a>
        
    
</div>




<ul>
    <li>
        <div class="all active" data-rel="全部文章">全部文章
            
                <small>(16)</small>
            
        </div>
    </li>
    
        
            
                <li>
                    <div data-rel="技巧">
                        
                        技巧
                        <small>(2)</small>
                        
                    </div>
                    
                </li>
            
        
    
        
            
                <li>
                    <div data-rel="面试">
                        
                        面试
                        <small>(3)</small>
                        
                    </div>
                    
                </li>
            
        
    
        
            
                <li>
                    <div data-rel="日记">
                        
                        日记
                        <small>(1)</small>
                        
                    </div>
                    
                </li>
            
        
    
        
            
                <li>
                    <div data-rel="项目文档">
                        
                        项目文档
                        <small>(6)</small>
                        
                    </div>
                    
                </li>
            
        
    
        
            
                <li>
                    <div data-rel="hexo">
                        
                        hexo
                        <small>(2)</small>
                        
                    </div>
                    
                </li>
            
        
    
</ul>
<div class="left-bottom">
    <div class="menus">
        
            
            
            
    </div>
    <div>
        
            <a class="about  hasFriend  site_url"
               
               href="/about">关于</a>
        
        <a style="width: 50%"
                
                                           class="friends">友链</a>
        
    </div>
</div>
<input type="hidden" id="yelog_site_posts_number" value="16">

<div style="display: none">
    <span id="busuanzi_value_site_uv"></span>
    <span id="busuanzi_value_site_pv"></span>
</div>

    </div>
    <div class="nav-right">
        <div class="friends-area">
    <div class="friends-title">
        友情链接
        <i class="iconfont icon-left"></i>
    </div>
    <div class="friends-content">
        <ul>
            
            <li><a target="_blank" href="http://yelog.org/">叶落阁</a></li>
            
        </ul>
    </div>
</div>
        <div class="title-list">
    <div class="right-top">
        <div id="default-panel">
            <i class="iconfont icon-search" data-title="搜索 快捷键 i"></i>
            <div class="right-title">全部文章</div>
            <i class="iconfont icon-file-tree" data-title="切换到大纲视图 快捷键 w"></i>
        </div>
        <div id="search-panel">
            <i class="iconfont icon-left" data-title="返回"></i>
            <input id="local-search-input" autocomplete="off"/>
            <label class="border-line" for="input"></label>
            <i class="iconfont icon-case-sensitive" data-title="大小写敏感"></i>
            <i class="iconfont icon-tag" data-title="标签"></i>
        </div>
        <div id="outline-panel" style="display: none">
            <div class="right-title">大纲</div>
            <i class="iconfont icon-list" data-title="切换到文章列表"></i>
        </div>
    </div>

    <div class="tags-list">
    <input id="tag-search" />
    <div class="tag-wrapper">
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>技巧</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>面试</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>前端</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>日记</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>探花交友</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>项目</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>hexo</a>
            </li>
        
    </div>

</div>

    
    <nav id="title-list-nav">
        
        <a  class="全部文章 "
           href="/posts/55136.html"
           data-tag=""
           data-author="" >
            <span class="post-title" title="vue3">vue3</span>
            <span class="post-date" title="2021-12-07 10:07:53">2021/12/07</span>
        </a>
        
        <a  class="全部文章 "
           href="/posts/16107.html"
           data-tag=""
           data-author="" >
            <span class="post-title" title="Hello World">Hello World</span>
            <span class="post-date" title="2021-12-06 14:50:36">2021/12/06</span>
        </a>
        
        <a  class="全部文章 项目文档 "
           href="/posts/10003.html"
           data-tag="探花交友,项目"
           data-author="" >
            <span class="post-title" title="第三章 React-native - 基础">第三章 React-native - 基础</span>
            <span class="post-date" title="2020-11-11 11:11:11">2020/11/11</span>
        </a>
        
        <a  class="全部文章 项目文档 "
           href="/posts/10002.html"
           data-tag="探花交友,项目"
           data-author="" >
            <span class="post-title" title="第二章 探花交友 - 环境搭建">第二章 探花交友 - 环境搭建</span>
            <span class="post-date" title="2020-11-11 11:11:11">2020/11/11</span>
        </a>
        
        <a  class="全部文章 项目文档 "
           href="/posts/10001.html"
           data-tag="探花交友,项目"
           data-author="" >
            <span class="post-title" title="第一章 探花交友 - Android   课程安排">第一章 探花交友 - Android   课程安排</span>
            <span class="post-date" title="2020-11-11 11:11:11">2020/11/11</span>
        </a>
        
        <a  class="全部文章 项目文档 "
           href="/posts/10000.html"
           data-tag="探花交友,项目"
           data-author="" >
            <span class="post-title" title="探花交友-概述">探花交友-概述</span>
            <span class="post-date" title="2020-11-11 11:11:11">2020/11/11</span>
        </a>
        
        <a  class="全部文章 项目文档 "
           href="/posts/10005.html"
           data-tag="探花交友,项目"
           data-author="" >
            <span class="post-title" title="探花交友-插件">探花交友-插件</span>
            <span class="post-date" title="2020-11-11 11:11:11">2020/11/11</span>
        </a>
        
        <a  class="全部文章 项目文档 "
           href="/posts/10004.html"
           data-tag="探花交友,项目"
           data-author="" >
            <span class="post-title" title="第四章 探花交友 - 项目接口文档">第四章 探花交友 - 项目接口文档</span>
            <span class="post-date" title="2020-11-11 11:11:11">2020/11/11</span>
        </a>
        
        <a  class="全部文章 hexo "
           href="/posts/49579.html"
           data-tag="hexo"
           data-author="" >
            <span class="post-title" title="Hexo 加入字数统计 WordCount">Hexo 加入字数统计 WordCount</span>
            <span class="post-date" title="2020-11-04 17:20:29">2020/11/04</span>
        </a>
        
        <a  class="全部文章 hexo "
           href="/posts/21358.html"
           data-tag="hexo"
           data-author="" >
            <span class="post-title" title="生成永久链接(permalink) | hexo">生成永久链接(permalink) | hexo</span>
            <span class="post-date" title="2020-11-04 17:20:29">2020/11/04</span>
        </a>
        
        <a  class="全部文章 技巧 "
           href="/posts/60475.html"
           data-tag="技巧"
           data-author="" >
            <span class="post-title" title="思否免登陆复制方法">思否免登陆复制方法</span>
            <span class="post-date" title="2020-11-04 15:24:21">2020/11/04</span>
        </a>
        
        <a  class="全部文章 技巧 "
           href="/posts/64216.html"
           data-tag="技巧"
           data-author="" >
            <span class="post-title" title="网页可随意编辑">网页可随意编辑</span>
            <span class="post-date" title="2020-11-04 15:24:21">2020/11/04</span>
        </a>
        
        <a  class="全部文章 面试 "
           href="/posts/7266.html"
           data-tag="面试,前端"
           data-author="" >
            <span class="post-title" title="数组拷贝的方法">数组拷贝的方法</span>
            <span class="post-date" title="2020-11-04 15:24:21">2020/11/04</span>
        </a>
        
        <a  class="全部文章 面试 "
           href="/posts/53209.html"
           data-tag="面试,前端"
           data-author="" >
            <span class="post-title" title="网络协议">网络协议</span>
            <span class="post-date" title="2020-11-02 11:08:31">2020/11/02</span>
        </a>
        
        <a  class="全部文章 面试 "
           href="/posts/43383.html"
           data-tag="面试,前端"
           data-author="" >
            <span class="post-title" title="强缓存和协商缓存">强缓存和协商缓存</span>
            <span class="post-date" title="2020-10-30 14:26:59">2020/10/30</span>
        </a>
        
        <a  class="全部文章 日记 "
           href="/posts/58040.html"
           data-tag="日记"
           data-author="" >
            <span class="post-title" title="今日来了一只不速之客">今日来了一只不速之客</span>
            <span class="post-date" title="2020-10-23 17:39:09">2020/10/23</span>
        </a>
        
        <div id="no-item-tips">

        </div>
    </nav>
    <div id="outline-list">
    </div>
</div>

    </div>
    <div class="hide-list">
        <div class="semicircle" data-title="切换全屏 快捷键 s">
            <div class="brackets first"><</div>
            <div class="brackets">&gt;</div>
        </div>
    </div>
</aside>
<div id="post">
    <div class="pjax">
        <article id="post-探花交友/environment" class="article article-type-post" itemscope itemprop="blogPost">
    
        <h1 class="article-title">第二章 探花交友 - 环境搭建</h1>
    
    <div class="article-meta">
        
        
        
        <span class="book">
            <i class="iconfont icon-category"></i>
            
            
            <a  data-rel="项目文档">项目文档</a>
            
        </span>
        
        
        <span class="tag">
            <i class="iconfont icon-tag"></i>
            
            <a class="color5">探花交友</a>
            
            <a class="color3">项目</a>
            
        </span>
        
    </div>
    <div class="article-meta">
        
            发布时间 : <time class="date" title='最后更新: 2021-12-06 14:50:36'>2020-11-11 11:11</time>
        
    </div>
    <div class="article-meta">
        
        
        <span id="busuanzi_container_page_pv">
            阅读 :<span id="busuanzi_value_page_pv">
                <span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </span>
        </span>
        
        
    </div>
    
    <div class="toc-ref">
    
        <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%AC%AC%E4%BA%8C%E7%AB%A0-%E6%8E%A2%E8%8A%B1%E4%BA%A4%E5%8F%8B-%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA"><span class="toc-text">第二章 探花交友 - 环境搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%A6%82%E8%BF%B0"><span class="toc-text">概述</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85%E7%8E%AF%E5%A2%83%E4%BB%8B%E7%BB%8D"><span class="toc-text">安装环境介绍</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Node%E7%9A%84%E5%AE%89%E8%A3%85"><span class="toc-text">Node的安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Yarn%E7%9A%84%E5%AE%89%E8%A3%85"><span class="toc-text">Yarn的安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#JDK%E7%9A%84%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE"><span class="toc-text">JDK的安装与配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#JDK%E7%9A%84%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E9%85%8D%E7%BD%AE"><span class="toc-text">JDK的环境变量配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Android-SDK%E7%9A%84%E4%B8%8B%E8%BD%BD%E4%B8%8E%E5%AE%89%E8%A3%85"><span class="toc-text">Android SDK的下载与安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Android-SDK%E7%9A%84%E4%B8%8B%E8%BD%BD%E9%A1%B9"><span class="toc-text">Android SDK的下载项</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Android%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E8%AE%BE%E7%BD%AE"><span class="toc-text">Android环境变量设置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%9D%E5%A7%8B%E5%8C%96%E9%A1%B9%E7%9B%AE%E5%92%8C%E6%89%93%E5%8C%85APP%E5%88%B0%E6%89%8B%E6%9C%BA"><span class="toc-text">初始化项目和打包APP到手机</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%89%8B%E6%9C%BA%E5%B1%8F%E5%B9%95%E6%8A%95%E5%BD%B1%E5%B7%A5%E5%85%B7"><span class="toc-text">手机屏幕投影工具</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E6%95%99%E7%A8%8B"><span class="toc-text">使用教程</span></a></li></ol></li></ol></li></ol>
    
<style>
    .left-col .switch-btn,
    .left-col .switch-area {
        display: none;
    }
    .toc-level-3 i,
    .toc-level-3 ol {
        display: none !important;
    }
</style>
</div>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="第二章-探花交友-环境搭建"><a href="#第二章-探花交友-环境搭建" class="headerlink" title="第二章 探花交友 - 环境搭建"></a>第二章 探花交友 - 环境搭建</h1><h2 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h2><p><code>react-native</code> 的环境搭建相比较于普通的web项目(vue、react）来说要繁琐不少，但是通过以下的方式基本都可以得到解决。</p>
<ul>
<li>老师的文档</li>
<li><a target="_blank" rel="noopener" href="https://reactnative.cn/docs/getting-started.html">RN的官网文档</a></li>
<li>百度+谷歌</li>
</ul>
<h2 id="安装环境介绍"><a href="#安装环境介绍" class="headerlink" title="安装环境介绍"></a>安装环境介绍</h2><ul>
<li>操作系统：win10专业版</li>
<li>手机：<code>安卓手机真机</code>一部或夜神模拟器</li>
<li>必须安装的依赖有:Node、JDK、Yarn、Android SDK、Python2</li>
</ul>
<h2 id="Node的安装"><a href="#Node的安装" class="headerlink" title="Node的安装"></a>Node的安装</h2><ul>
<li>先到 <a target="_blank" rel="noopener" href="http://nodejs.cn/">官网 </a>去下载node版本(使用 <a target="_blank" rel="noopener" href="https://github.com/coreybutler/nvm-windows">nvm</a> 工具来安装也可以)</li>
<li>老师当前是用的 <strong>12.16.3</strong> 版本</li>
<li>以 <strong>管理员</strong> 身份安装 然后一直点击下一步即可</li>
</ul>
<h2 id="Yarn的安装"><a href="#Yarn的安装" class="headerlink" title="Yarn的安装"></a><a target="_blank" rel="noopener" href="https://yarn.bootcss.com/">Yarn</a>的安装</h2><p>Yarn是Facebook提供的替代npm的工具，可以加速node模块的下载</p>
<pre><code class="js">npm install yarn -g  // 使用npm全局安装yarn </code></pre>
<p>检查是否安装成功</p>
<pre><code class="js">yarn -v</code></pre>
<p><strong>效果如下:</strong></p>
<p><img src="/friend/image-20200522155320956.png" alt="image-20200522155320956"></p>
<h2 id="JDK的安装与配置"><a href="#JDK的安装与配置" class="headerlink" title="JDK的安装与配置"></a>JDK的安装与配置</h2><blockquote>
<p>Java SE Development Kit</p>
</blockquote>
<p>安卓系统的APP离不开JAVA环境，因此需要下载安装JDK(1.8版本)。到<a target="_blank" rel="noopener" href="https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">该网站</a>下载JDK</p>
<p><img src="/friend/image-20200522155509416.png" alt="image-20200522155509416"></p>
<p>需要注意的是单击下载之后，会跳转到一个Oracler的登陆页面，得登陆之后才可以下载，如果没有账号可以注册一<br>个，也是比较简单，下载完成之后，以管理身份进行l默认安装。</p>
<h3 id="JDK的环境变量配置"><a href="#JDK的环境变量配置" class="headerlink" title="JDK的环境变量配置"></a>JDK的环境变量配置</h3><p>1.右键我的电脑，点属性</p>
<p><img src="/friend/image-20200522161608862.png" alt="image-20200522161608862"></p>
<p>2.然后单击高级系统设置，在弹出来的对话框中单击高级，再单击环境变量</p>
<p><img src="/friend/image-20200522161628275.png" alt="image-20200522161628275"></p>
<p>3.在弹出来的对话框中设置如下</p>
<p><img src="/friend/image-20200522161647214.png" alt="image-20200522161647214"></p>
<p>4.然后在 <strong>系统变量</strong> 中找到path项单击，然后再单击下面的编辑，在弹出框中设置如下</p>
<p><img src="/friend/image-20200522161712608.png" alt="image-20200522161712608"></p>
<p>5.到此JDK的环境变量设置完毕，可以再次打开命令行终端，使用命令 <code>java</code> 与 <code>javac</code> 检测一下是否设置<br>成功。</p>
<p><img src="/friend/image-20200522161731987.png" alt="image-20200522161731987"></p>
<hr>
<p><img src="/friend/image-20200522161746069.png" alt="image-20200522161746069"></p>
<h2 id="Android-SDK的下载与安装"><a href="#Android-SDK的下载与安装" class="headerlink" title="Android SDK的下载与安装"></a>Android SDK的下载与安装</h2><p>我们可以直接下载Android SDK并进行必要配置<br>1.首先打开 <a target="_blank" rel="noopener" href="https://www.androiddevtools.cn/">网站</a>，然后一直向下拉，找到 SDK Tools 进行下载</p>
<p><img src="/friend/image-20200522161947215.png" alt="image-20200522161947215"></p>
<p>2.以管理员身份安装此软件，设置 允许使用此计算机的所有人 选项，其它一路默认到底，直到安装完成.<br>切记，切记，切记，重要的事情说三遍，一定记着Android SDK的安装路径，后面会打开这个管理器下载东<br>西</p>
<p><img src="/friend/image-20200522162022143.png" alt="image-20200522162022143"></p>
<h2 id="Android-SDK的下载项"><a href="#Android-SDK的下载项" class="headerlink" title="Android SDK的下载项"></a>Android SDK的下载项</h2><p>1.根据RN中文网的描述，编译React Native应用需要的是Android 9版本的SDK，还需要各种组件，为<br>了当前以及后期的稳定，总结起来，总共需要下载:</p>
<ul>
<li>Android SDK Tools 25.2.5</li>
<li>Android SDK Platform-tools 29.0.5</li>
<li>Android SDK Build-tools 29</li>
<li>Android SDK Build-tools 28.0.3</li>
<li>Android SDK Build-tools 28.0.2</li>
<li>Android SDK Build-tools 28.0.1</li>
<li>Android SDK Build-tools 28</li>
<li>Android SDK Build-tools 27</li>
<li>SDK Platform 29</li>
<li>Intel x86 Atom System Image 29</li>
<li>SDK Platform 28</li>
<li>Intel x86 Atom System Image 28</li>
<li>SDK Platform 27</li>
</ul>
<p>2.接下来，打开<code>SDK Manager.exe</code>，照此截图依次下载以上SDK及组件</p>
<p><img src="/friend/image-20200522162144179.png" alt="image-20200522162144179"></p>
<hr>
<p><img src="/friend/image-20200522162154907.png" alt="image-20200522162154907"></p>
<hr>
<p><img src="/friend/image-20200522162228056.png" alt="image-20200522162228056"></p>
<hr>
<p><img src="/friend/image-20200522162257510.png" alt="image-20200522162257510"></p>
<p>3.此下载的过程取决于自家的网速了，不过一般都会成功的，耐心等待安装完成即可。</p>
<h2 id="Android环境变量设置"><a href="#Android环境变量设置" class="headerlink" title="Android环境变量设置"></a>Android环境变量设置</h2><p>1.右键选中 此电脑 点属性，再点高级，再点环境变量，设置如下</p>
<p><img src="/friend/image-20200522162417205.png" alt="image-20200522162417205"></p>
<hr>
<p><img src="/friend/image-20200522162431658.png" alt="image-20200522162431658"></p>
<p>2.到此，安卓的环境变量配置完成</p>
<h2 id="初始化项目和打包APP到手机"><a href="#初始化项目和打包APP到手机" class="headerlink" title="初始化项目和打包APP到手机"></a>初始化项目和打包APP到手机</h2><ol>
<li><p>准备一台  Android 手机, 通过数据线 连接 到电脑，设置启用 USB调试</p>
</li>
<li><p>如果没有安卓手机，可以使用安卓模拟器也可以，推荐使用 夜神模拟器 ，自行百度下载安装</p>
</li>
<li><p>一般的手机在 设置 中可以直接找到 开发者选项 进行开启, 如果 找不到 , 就自行百度查一下</p>
<p><img src="/friend/image-20200522170648131.png" alt="image-20200522170648131"></p>
</li>
<li><p>手机连接电脑成功后运行检测命令  <code>adb devices</code> , 如果有输出设备列表与  ID 相关的字符串就证明<br>手机和电脑是连接成功了，如果没有显示设备号，则说明连接有问题，一定要保证手机和电脑是正常连接状态</p>
<p><img src="/friend/image-20200522170726891.png" alt="image-20200522170726891"></p>
</li>
<li><p>运行  <code>npx react-native init 项目名称</code> 命令初始化一个  React-Native 项目, 创建时需要联网 下载 依赖<br>包, 可能比较慢，取决于各自的网速，一定要耐心等待，如果出错了，则重新运行命令再次初始化即可，例<br>如：</p>
<pre><code class="js">npx react-native init myApp </code></pre>
</li>
<li><p>使用 <code>cd myApp</code> 命令进行此项目文件夹，确保手机和电脑连接正常的情况下，然后再输入命令 ``adb<br>devices <code>来检测一下手机是否正常连接，然后再使用命令 </code>yarn android`   将APP打包到手<br>机上</p>
</li>
<li><p>手机上出现如下画面，说明打包成功</p>
<p><img src="/friend/image-20200522170849831.png" alt="image-20200522170849831"></p>
</li>
</ol>
<h2 id="手机屏幕投影工具"><a href="#手机屏幕投影工具" class="headerlink" title="手机屏幕投影工具"></a>手机屏幕投影工具</h2><p>为了在电脑上看到真实的手机屏幕,可以安装手机屏幕投影工具</p>
<p>网上有很多工具,百度即可看到。老师使用的是  <a target="_blank" rel="noopener" href="https://github.com/Genymobile/scrcpy">scrcpy</a></p>
<h3 id="使用教程"><a href="#使用教程" class="headerlink" title="使用教程"></a>使用教程</h3><ol>
<li><p>下载好 工具 </p>
</li>
<li><p>手机通过usb连接到电脑</p>
</li>
<li><p>双击打开工具即可</p>
<p><img src="/friend/image-20200522172425782.png" alt="image-20200522172425782"></p>
</li>
</ol>

      
       <hr><span style="font-style: italic;color: gray;"> 转载请注明来源，欢迎对文章中的引用来源进行考证，欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论，也可以邮件至 jaytp@qq.com </span>
    </div>
</article>


<p>
    <a  class="dashang" onclick="dashangToggle()">赏</a>
</p>






    




    </div>
    <div class="copyright">
        <p class="footer-entry">
    ©2016-2020 Yelog
</p>
<p class="footer-entry">Built with <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/yelog/hexo-theme-3-hexo" target="_blank">3-hexo</a> theme</p>

    </div>
    <div class="full-toc">
        <button class="full" data-title="切换全屏 快捷键 s"><span class="min "></span></button>
<a class="" id="rocket" ></a>

    </div>
</div>

<div class="hide_box" onclick="dashangToggle()"></div>
<div class="shang_box">
    <a class="shang_close"  onclick="dashangToggle()">×</a>
    <div class="shang_tit">
        <p>喜欢就点赞,疼爱就打赏</p>
    </div>
    <div class="shang_payimg">
        <div class="pay_img">
            <img src="/img/alipay.jpg" class="alipay" title="扫码支持">
            <img src="/img/weixin.jpg" class="weixin" title="扫码支持">
        </div>
    </div>
    <div class="shang_payselect">
        <span><label><input type="radio" name="pay" checked value="alipay">支付宝</label></span><span><label><input type="radio" name="pay" value="weixin">微信</label></span>
    </div>
</div>


</body>
<script src="/js/jquery.pjax.js?v=1.1.0" ></script>

<script src="/js/script.js?v=1.1.0" ></script>
<script>
    var img_resize = 'default';
    function initArticle() {
        /*渲染对应的表格样式*/
        
            $("#post .pjax table").addClass("green_title");
        

        /*渲染打赏样式*/
        
        $("input[name=pay]").on("click", function () {
            if($("input[name=pay]:checked").val()=="weixin"){
                $(".shang_box .shang_payimg .pay_img").addClass("weixin_img");
            } else {
                $(".shang_box .shang_payimg .pay_img").removeClass("weixin_img");
            }
        })
        

        /*高亮代码块行号*/
        

        /*访问数量*/
        
        $.getScript("//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js");
        

        /*代码高亮，行号对齐*/
        $('.pre-numbering').css('line-height',$('.has-numbering').css('line-height'));

        
        
    }

    /*打赏页面隐藏与展示*/
    
    function dashangToggle() {
        $(".shang_box").fadeToggle();
        $(".hide_box").fadeToggle();
    }
    

</script>

<!--加入行号的高亮代码块样式-->

<!--自定义样式设置-->
<style>
    
    
    .nav {
        width: 542px;
    }
    .nav.fullscreen {
        margin-left: -542px;
    }
    .nav-left {
        width: 120px;
    }
    
    
    @media screen and (max-width: 1468px) {
        .nav {
            width: 492px;
        }
        .nav.fullscreen {
            margin-left: -492px;
        }
        .nav-left {
            width: 100px;
        }
    }
    
    
    @media screen and (max-width: 1024px) {
        .nav {
            width: 492px;
            margin-left: -492px
        }
        .nav.fullscreen {
            margin-left: 0;
        }
    }
    
    @media screen and (max-width: 426px) {
        .nav {
            width: 100%;
        }
        .nav-left {
            width: 100%;
        }
    }
    
    
    .nav-right .title-list nav a .post-title, .nav-right .title-list #local-search-result a .post-title {
        color: #383636;
    }
    
    
    .nav-right .title-list nav a .post-date, .nav-right .title-list #local-search-result a .post-date {
        color: #5e5e5f;
    }
    
    
    .nav-right nav a.hover, #local-search-result a.hover{
        background-color: #e2e0e0;
    }
    
    

    /*列表样式*/
    

    /* 背景图样式 */
    
    


    /*引用块样式*/
    

    /*文章列表背景图*/
    

    
</style>







</html>
